#include <bits/stdc++.h>

using namespace std;

class Solution {
public:
	int numberOfArrays(vector<int>& differences, int lower, int upper)
	{
		long cur = 0, min = 0, max = 0;
		for (int i : differences) {
			cur += i;
			if (cur > max)
				max = cur;
			if (cur < min)
				min = cur;
		}
		long res = (upper - lower) - (max - min) + 1;
		return res > 0 ? res : 0;
	}

private:
};

int main()
{
	[[maybe_unused]] Solution solution;
	return 0;
}
